define.template({
    type: 'Dialog',
    preload: 'g/form',
    node: {
        type: 'View',
        commands: {
            'yes': {
                type: 'Submit',
                src: 'user/save',
                // $.dialog(this).ownerView.
                success: '$.dialog(this).ownerView.cmd("search");$.alert("保存成功","br",3000);$.close(this);'
            }
        },
        node: {
            type: 'Form',
            hiddens: [
                {name: 'userId', '@value': '$data.userId'}
            ],
            nodes: [
                {
                    type: 'Text',
                    name: 'userName',
                    label: {text: '姓名'},
                    '@value': '$data.userName',
                    validate: {required: true}
                },
                {
                    type: 'Text',
                    name: 'loginName',
                    label: {text: '登录名'},
                    '@value': '$data.loginName',
                    validate: {required: true},
                    '@status': '$data.userId?"readonly":null'
                },
                {
                    type: 'Text',
                    name: 'orgId',
                    label: {text: '所属机构'},
                    value: '',
                    status: 'readonly',
                    '@value': '$data.orgId'
                },
                {
                    type: 'RadioGroup', name: 'gender', label: {text: '性别'}, '@value': '$data.gender?$data.gender:"1"',
                    nodes: [
                        {value: '1', text: '男'},
                        {value: '2', text: '女'}
                    ]
                },
                {type: 'Text', name: 'telephone', label: {text: '手机'}, '@value': '$data.telephone'},
                {type: 'Text', name: 'email', label: {text: '邮箱'}, '@value': '$data.email'},
                {
                    type: 'RadioGroup', name: 'userStatus', label: {text: '状态'}, '@value': '$data.userStatus',
                    nodes: [
                        {value: '1', text: '启用'},
                        {value: '0', text: '禁用'}
                    ]
                }
            ]
        }
    }
});